package com.nearby.demand.adapter;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.OrientationHelper;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;

import com.nearby.demand.R;
import com.nearby.demand.db.Demand;
import com.nearby.demand.model.News;
import com.nearby.demand.utils.KLog;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by lizhangqu on 2015/6/home_3.
 */
public class TimeLineAdapter extends BaseRecyclerViewAdapter<Demand, TimeLineAdapter.MyViewHolder> {

    public TimeLineAdapter(List<Demand> list) {
        super(list);
    }


    @Override
    protected void bindDataToItemView(MyViewHolder myViewHolder, Demand item) {
        KLog.i(item.getStPid());
        //最后一项时，竖线不再显示
//        if (item.getPosition() == super.mList.size() - 1) {
//            myViewHolder.setVisible(R.id.line_normal, false);
//            myViewHolder.setVisible(R.id.linear_content, false);
//        }
        RecyclerView recyclerView =  myViewHolder.getView(R.id.recycler_view_collect);
        List<News> list = new ArrayList<>();
        for (int i = 0 ; i <30;i++){
            News news = new News();
            news.setTitle("哈哈"+i);
            list.add(news);
        }
        recyclerView.setHasFixedSize(true);//固定尺寸
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(super.activity);
        linearLayoutManager.setOrientation(OrientationHelper.HORIZONTAL);
        recyclerView.setLayoutManager(linearLayoutManager);


        recyclerView.setAdapter(new CollectAdapter(list));
    }


    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup viewGroup, int type) {

        return new MyViewHolder(inflateItemView(viewGroup, R.layout.time_line));


    }


    public class MyViewHolder extends BaseRecyclerViewAdapter.SparseArrayViewHolder {

        public MyViewHolder(View itemView) {
            super(itemView);

        }


    }

}
